<template>
  <div>
    <el-card class="topInfo">
      <span class="avatar"><img src="../static/img/avatar.jpg" /></span>
      <h3>{{ userInfo.name }}</h3>
      <el-row>
        <el-col :span="8">
          <h5>文章</h5>
          <strong>108</strong>
        </el-col>
        <el-col :span="8">
          <h5>标签</h5>
          <strong>79</strong>
        </el-col>
        <el-col :span="8">
          <h5>分类</h5>
          <strong>{{ categoryList.length }}</strong>
        </el-col>
      </el-row>
    </el-card>
    <el-card class="notice">
      <div slot="header" class="clearfix">
        <span><i class="el-icon-bell"></i>公告</span>
      </div>
      <div class="notice_body">
        <p>
          如果阅读过程中遇到了问题，请及时评论或者留言，看到了会在第一时间给出回复
        </p>
        <el-button type="primary">加入QQ群</el-button>
      </div>
    </el-card>
    <el-card class="adv1"><img src="../static/upload/adv1.png" /></el-card>
    <div class="adv2_swiper">
      <el-carousel trigger="click" height="200px" arrow="never">
        <el-carousel-item v-for="item in 4" :key="item">
          <img src="../static/upload/1691589550076.jpg" />
        </el-carousel-item>
      </el-carousel>
    </div>
    <el-card class="new_articleList">
      <div slot:header>
        <i class="el-icon-folder-opened"></i><span>分类</span>
        <el-button
          style="float: right; padding: 3px 0; color: #333333"
          type="text"
          icon="el-icon-arrow-right"
        ></el-button>
      </div>
      <div class="itemList">
        <el-row v-for="(item, index) in categoryList" :key="index">
          <el-col :span="20" class="content">{{ item.type }}</el-col>
          <el-col :span="4" class="count">27</el-col>
        </el-row>
      </div>
    </el-card>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState(["userInfo", "categoryList"]),
  },
};
</script>

<style scoped>
.topInfo {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 360px;
}
.avatar {
  width: 124px;
  height: 124px;
  display: flex;
  margin: 0px auto 37px;
  overflow: hidden;
  border-radius: 50%;
}

.topInfo h3 {
  font-size: 26px;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-info-color);
}

.topInfo .el-col {
  text-align: center;
}

.topInfo .el-col h5 {
  font-size: 18px;
  color: #5d5d5d;
  font-weight: normal;
  margin-bottom: 20px;
}

.topInfo .el-col strong {
  display: block;
  font-size: 32px;
  color: var(--text-color);
}

.notice span {
  display: inline-block;
  font-size: 18px;
  color: var(--text-info-color);
}

.notice i {
  display: inline-block;
  margin-right: 8px;
  color: var(--text-info-color);
}

.notice_body p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-info-color);
}

.notice_body .el-button {
  width: 100%;
  margin-top: 30px;
}

.adv1 {
  position: relative;
  width: 100%;
  height: 145px;
  overflow: hidden;
  cursor: pointer;
}

.adv1 img {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 105%;
}

.adv2_swiper {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 4px;
  background-color: #fff;
  overflow: hidden;
  color: var(--text-info-color);
  transition: 0.3s;
  margin-bottom: 15px;
}

.adv2_swiper .el-carousel-item,
.adv2_swiper img {
  width: 100%;
  height: 200px;
}

.new_articleList span {
  display: inline-block;
  font-size: 18px;
  color: var(--text-info-color);
}

.new_articleList i {
  display: inline-block;
  font-size: 18px;
  margin-right: 8px;
  color: var(--text-info-color);
}

.new_articleList .itemList {
  margin: 20px 0px;
}

.new_articleList .itemList .el-row {
  cursor: pointer;
  line-height: 50px;
}

.new_articleList .itemList .content {
  font-size: 16px;
  color: var(--text-info-color);
}

.new_articleList .itemList .count {
  font-size: 14px;
  color: #949494;
  text-align: right;
}
</style>